package com.dykj.fireFighting.server.socialUnit.firemanger.mapper;

import com.dykj.fireFighting.api.socialUnit.firemanger.entity.CoordinateRelation;
import com.dykj.fireFighting.common.core.mapper.SuperMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * @Description 消防站、重点部位、危险源关系表
 * @Author JacksonTu
 * @Date  2021-07-21 08:33:39
 */
public interface CoordinateRelationMapper extends SuperMapper<CoordinateRelation> {
    /**
     * 根据关系ID更新经纬度
     * @param lng
     * @param lat
     * @param tableId
     * @return
     */
    @Update("update  coordinate_relation  set lng=#{lng} ,lat=#{lat} where table_id=#{tableId}")
    Boolean updateByTableID(@Param("lng") String lng,@Param("lat") String lat,@Param("tableId") String tableId);

    @Select("select * from coordinate_relation  where table_id=#{tableId} and table_type=#{type}")
    List<CoordinateRelation> getByTableId(@Param("tableId") String tableId,@Param("type") String type);

    /**
     * 根据单位编号查询
     * @param unitId
     * @return
     */
    @Select("select * from coordinate_relation  where unit_id=#{unitId} ")
    List<CoordinateRelation> getCoordinateByUnitId(@Param("unitId") String unitId);

    @Delete("DELETE  from coordinate_relation  where table_id=#{tableId} and table_type=#{type}")
    Boolean deleteByTableId(@Param("tableId") String tableId,@Param("type") String type);
}
